package com.mvp.shq.washer.ui.aboutUs;

import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.text.Html;
import android.widget.ImageView;
import android.widget.TextView;

import com.jaeger.library.StatusBarUtil;
import com.mvp.shq.washer.R;
import com.mvp.shq.washer.base.BaseActivity;
import com.mvp.shq.washer.utils.T;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class  AboutUsActivity extends BaseActivity<Presenter, Model> implements AboutUsConstract.View {


    @BindView(R.id.title)
    TextView title;
    @BindView(R.id.img_qrcode)
    ImageView imgQrcode;
    @BindView(R.id.tv_version)
    TextView tvVersion;
    @BindView(R.id.tv_aboutus_content)
    TextView tvAboutUs;

    @Override
    public int getLayoutId() {
        return R.layout.activity_about_us;
    }

    @Override
    public void initView() {
        showLoadingDialog(true);
        presenter.getAboutUs();
    }


    @OnClick(R.id.back)
    public void onViewClicked() {
        finish();
    }

    @Override
    public void getAboutUsS(String content) {

        CharSequence charSequence = Html.fromHtml(content, new Html.ImageGetter() {
            @Override
            public Drawable getDrawable(String source) {
                Drawable drawable=AboutUsActivity.this.getResources().getDrawable(R.mipmap.fail_img);
//                //下面这句话不可缺少
                drawable.setBounds(0,0,drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight());
                return drawable;
            }
        },null);
        tvAboutUs.setText(charSequence);
    }

    @Override
    public void getAboutUsF(String msg) {
        T.show(msg);
    }
}
